package com.guli.common.constant;
/*
 * @Author 罗俊
 * @date 2020/11/18 - 1:06 下午
 *
 */

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

public class OrderConstant {

    /**
     * 结账的URL
     */
    public static final String PAY_URL = "http://order.guli.com/cacheRegister/index.html";

    /**
     * 下订单之前的防重令牌，用于防止重复提交订单
     */
    public static final String PRE_ORDER_TOKEN_PREFIX = "order::pre::token::";

    /**
     * 默认的订单自动确认时间（天）
     */
    public static final Integer DEFAULT_ORDER_AUTO_CONFIRM_TIME_DAY = 7;

    /**
     * 消息队列相关
     */
    // 延迟队列只能被交换机订阅
    public static final String ORDER_DELAY_QUEUE = "order.delay.queue";

    public static final String ORDER_RELEASE_QUEUE = "order.release.queue";

    public static final String ORDER_EVENT_EXCHANGE = "order.event.exchange";

    public static final String ORDER_CREATE_ORDER_ROUTING_KEY = "order.create.order.routingKey";

    public static final String ORDER_RELEASE_ORDER_ROUTING_KEY = "order.release.order.routingKey";

    /**
     * 订单支付时长，超时后自动关闭订单，单位毫秒
     * */
    public static final Integer ORDER_PAYMENT_TIME = 30 * 60 * 1000;

    /**
     * 内网穿透时使用的公网DNS
     */
    public static final String PUBLIC_DNS = "http://1t61393v82.51vip.biz";

    /**
     * 支付宝，支付成功的回调地址
     */
    public static final String ALI_PAY_SUCCESS_RETURN_URL = PUBLIC_DNS + "/mall/payment/alipay/afterAliPayment";

    /**
     * 支付宝支付成功的异步回调地址
     */
    public static final String ALI_PAY_SUCCESS_NOTIFY_URL = PUBLIC_DNS + "/mall/payment/alipay/async/notify";

    /**
     * 操作员id，用于关闭支付宝订单时写明
     * */
    public static final String OPERATOR_ID_FOR_ALIPAY = "system-order-service";

    /**
     * 接收订单号，用于创建订单的路由key
     * */
    public static final String SEC_KILL_CREATE_ORDER_ROUTING_KEY = "secKill.create.order.routingKey";

    /**
     * 接收订单号等信息，创建订单
     * */
    public static final String SEC_KILL_CREATE_ORDER_QUEUE = "secKill.create.order.queue";

    public enum PayType implements BaseEnum {
        ZHI_FU_BAO(1, "支付宝"),
        WE_CHAT(2, "微信"),
        BANK(3, "银联"),
        CASH_ON_DELIVERY(4, "货到付款");

        @EnumValue//标记数据库存的值是code
        private Integer code;

        @JsonValue    //标记响应json值
        private String message;

        PayType(Integer code, String message) {
            this.code = code;
            this.message = message;
        }

        public Integer getCode() {
            return code;
        }

        @Override
        public String getMessage() {
            return message;
        }

    }

    public enum SourceType implements BaseEnum {
        PC(0, "pc订单"),
        APP(1, "app订单");

        @EnumValue//标记数据库存的值是code
        private Integer code;

        @JsonValue    //标记响应json值
        private String message;

        SourceType(Integer code, String message) {
            this.code = code;
            this.message = message;
        }

        public Integer getCode() {
            return code;
        }

        @Override
        public String getMessage() {
            return message;
        }
    }

    public enum Status implements BaseEnum {
        WAITING_FOR_PAYMENT(0, "待付款"),
        WAITING_FOR_DELIVER(1, "待发货"),
        HAS_BEEN_DELIVERED(2, "已发货"),
        COMPLETED(3, "已完成"),
        CLOSED(4, "已关闭"),
        INVALID(5, "无效订单");

        @EnumValue//标记数据库存的值是code
        @JsonValue    //标记响应json值
        private Integer code;


        private String message;

        Status(Integer code, String message) {
            this.code = code;
            this.message = message;
        }

        public Integer getCode() {
            return code;
        }

        @Override
        public String getMessage() {
            return message;
        }


    }

    public enum BillType implements BaseEnum {
        NOT_BILL(0, "不开发票"),
        E_BILL(1, "电子发票"),
        PAPER_BILL(2, "纸质发票");

        @EnumValue//标记数据库存的值是code
        private Integer code;

        @JsonValue    //标记响应json值
        private String message;

        BillType(Integer code, String message) {
            this.code = code;
            this.message = message;
        }

        @Override
        public Integer getCode() {
            return code;
        }

        @Override
        public String getMessage() {
            return message;
        }
    }

    public enum ConfirmStatus implements BaseEnum {
        UNCONFIRMED(0, "未确认"),
        CONFIRMED(1, "已确认");

        @EnumValue//标记数据库存的值是code
        private Integer code;

        @JsonValue    //标记响应json值
        private String message;

        ConfirmStatus(Integer code, String message) {
            this.code = code;
            this.message = message;
        }

        public Integer getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }
    }

    public enum DeleteStatus implements BaseEnum {
        UNDELETED(0, "未删除"),
        DELETED(1, "已删除");

        @EnumValue//标记数据库存的值是code
        private Integer code;

        @JsonValue    //标记响应json值
        private String message;

        DeleteStatus(Integer code, String message) {
            this.code = code;
            this.message = message;
        }

        public Integer getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }
    }
}
